#include "ConfirmPanelMenu.h"
#include "Utilities.h"
#include "PrintUtilities.h"
#include "MenuManager.h"

#include <cassert>

ConfirmPanelMenu::ConfirmPanelMenu(MenuManager* const i_menuManager)
	: Menu(i_menuManager)
{
}

void ConfirmPanelMenu::Draw() const
{
	std::cout << Print::Title("CONFIRM PANEL");
	std::cout << "Are you sure?\n\n";
	std::cout << Print::Options(" Write \"yes\" or \"no\"");
	std::cout << "Selection: ";	
}

bool ConfirmPanelMenu::Input(const std::string& i_input)
{
	assert(m_delegate);

	bool goodInput = true;

	//i_input = std::uppercase(i_input);

	if (i_input == "YES" || i_input == "yes")
	{	
		m_delegate->PanelWillClose(true);
		GetMM()->PopMenu();
	}
	else if (i_input == "NO" || i_input == "no")
	{	
		m_delegate->PanelWillClose(false);
		GetMM()->PopMenu();
	}
	else
		goodInput = false;

	return goodInput;
}

void ConfirmPanelMenu::SetDelegate(IPanelDelegate* i_delegate)
{
	m_delegate = i_delegate;
}